import os

from pydantic import BaseModel, computed_field


class SenderConfig(BaseModel):
    """寄件人配置"""

    name: str = ""
    phone: str = ""
    fixed_phone: str = ""
    address: str = ""


class Config(BaseModel):
    db_path: str = "data/hitsz-arch-management.db"
    sender: SenderConfig = SenderConfig()
    yjtz_benke_template_path: str = (
        "templates/1-通知单/应届毕业生通知单/本科生档案转递通知单—更新时间20230620.docx"
    )
    yjtz_yanjiusheng_template_path: str = (
        "templates/1-通知单/应届毕业生通知单/研究生档案转递通知单—更新时间20230620.docx"
    )

    wjtz_benke_template_path: str = (
        "templates/1-通知单/非应届毕业生通知单/本科毕业生档案转递通知单-2024.docx"
    )
    wjtz_shuoshi_template_path: str = (
        "templates/1-通知单/非应届毕业生通知单/硕士毕业生档案转递通知单-2024.docx"
    )
    wjtz_boshi_template_path: str = (
        "templates/1-通知单/非应届毕业生通知单/博士毕业生档案转递通知单-2024.docx"
    )
    kuaidi_template_path: str = "templates/2-快递单/菜鸟发货平台专用导入模板（灵活寄件地址版，最多导入5000个）.xlsx"
    output_dir: str = "output"

    @computed_field
    @property
    def wjtz_output_dir(self) -> str:
        return os.path.join(self.output_dir, "非应届通知单")

    @computed_field
    @property
    def yjtz_output_dir(self) -> str:
        return os.path.join(self.output_dir, "应届通知单")

    @computed_field
    @property
    def kuaidi_output_dir(self) -> str:
        return os.path.join(self.output_dir, "快递单")

    fahuo_url: str = "https://fahuo.cainiao.com/web/order/consign.htm"
    help_url: str = "https://gitee.com/hitsz-archives/hitsz-archives-management-system"
